#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：    interactive_index.py
   Author :       zyq
   CreateDate：   2024/7/21 09:00
   Remark :  web交互页面元素，方法
-------------------------------------------------
"""

from guitesting.common.bash.bash_ui.page_element import PageElement, BasePage


class InteractiveIndexPage(BasePage):
    url = "http://xn--6frwj470ei1s2kl.com/demo"
    # 按钮（button)
    button_link = PageElement(xpath="/html/body/div[1]/div/div/main/div/div[2]/a[1]")
    button_me_test_01 = PageElement(xpath="/html/body/div[1]/div/div/main/div/button[1]/span[2]/span")
    button_me_test_01_check = PageElement(xpath="/html/body/div[4]/div/div[6]/div/div/div/div")
    button_me_test_02 = PageElement(xpath="/html/body/div[1]/div/div/main/div/button[2]/span[2]/span")

    # 按步骤操作
    stepper_link = PageElement(xpath="/html/body/div[1]/div/div/main/div/div[2]/a[4]")
    # 下拉框选框
    dropdown_link = PageElement(xpath="/html/body/div[1]/div/div/main/div/div[2]/a[5]")


    def button_test(self):
        """按钮（button）测试"""
        self.get_url(url=self.url)
        self.button_link.click_element()
        self.button_me_test_01.click_element()
        self.button_me_test_01_check.check_alert_text()
        # self.
        self.button_me_test_02.click_element()


    def stepper_test(self):
        """按步骤操作测试"""
        self.get_url(url=self.url)
        self.stepper_link.click_element()

    def dropdown_test(self):
        """下拉框选框测试"""
        self.get_url(url=self.url)
        self.dropdown_link.click_element()
        # self.get

        # el = driver.find_element('id', "fileinput")

        # ActionChains(self.driver).click(self.upload_file_input.element).perform()
